import request from '@/utils/request'

// 获取路由
export const getRouters = () => {
  return request({
    url: '/getRouters',
    method: 'get'
  })
}

export function fetchTableList(url = null, data = {}, method = 'get') {
  if (!url) {
    console.log(' URL 不能为空');
    return new Promise(
      (resolve) => {
        return Boolean(url);
      },
      (reject) => {
        return Boolean(url);
      }
    );
  }
  const params = { [method === 'get' ? 'params' : 'data']: data };
  return request({
    url,
    method,
    ...params
  });
}